package com.broad.school_description.configuration;

import com.broad.school_description.intercept.PageFoundCountIntercept;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class PageFoundCountInterceptConfiguration implements WebMvcConfigurer {
    //注入自定义登录拦截器
    @Bean
    public PageFoundCountIntercept pageFoundCountIntercept(){
        return new PageFoundCountIntercept();
    }


    /**
     * 注册拦截器
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //注册拦截器，拦截那些请求，放行那些请求
        registry.addInterceptor(pageFoundCountIntercept()).addPathPatterns("/team","/","/sample","/contact");

    }
}
